define(['../../../../../js/lib/other/sweet-alert'],function() {
    return ['$scope','$location', '$interval','$timeout','bizProxy', function($scope,$location,$interval,$timeout,bizProxy) {
		$scope.$emit("top-show",'true');//顶部显示
    	$scope.$emit('menuTypeLight','mine'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','9');//显示底部文字
    	
    	//点击去完善资料
    	$scope.goCompleteData = function(){
    		//goLogin('complete');
            $scope.$emit("goNext","/completeData");
    	}
    	
    	var timeOutFn = $timeout(function(){
    		//goLogin('timeout');
            if(transData.userType === '1'){
                $scope.$emit("goNext","/mineLs");
            }else{
                $scope.$emit("goNext","/minePt");
            }
        }, 7000);
    	
    	//去登陆
    	function goLogin(flag){
    		var headerInfo = {},sendData = {};
        	headerInfo.pageNum = '';
        	headerInfo.pageSize = '';
        	headerInfo.sessionId = transData.sessionId;
        	
        	sendData.loginType = "password";
    		sendData.mobileNo = transData.mobileNo;
    		sendData.password = transData.password;
    		$scope.$emit("loadingChange",true);
    		bizProxy.queryProxyBizData("userLogin",headerInfo,sendData,
    				function(tempData){//SUCCESS
    					$scope.$emit("loadingChange",false);
    					localStorage.setItem("fireFlySessionId",tempData.sessionId+"");
    					transData.pwd1 = "",transData.pwd2 = "",transData.mobileCheckNo = "";
						var body = JSON.parse(tempData.body);
						transData.mobileNo = body.mobileNo;
						transData.sessionId = tempData.sessionId;
						transData.userId = body.userId;
						transData.userType = body.userType;
						resultData.loginUserData = body;
						$timeout(function(){
							if(flag === "timeout"){
								if(transData.userType === '1'){
									$scope.$emit("goNext","/mineLs");
								}else{
									$scope.$emit("goNext","/minePt");
								}
							}else{
								$scope.$emit("goNext","/completePtData");
							}
						},0);
		    		},function(data){//FAIL
		    			if(data != ""){
		    				$scope.$emit("loadingChange",false);
		    				$scope.$emit("promptAlertMsg",data.errorMsg);
		    				$scope.$emit("showCollect",true);
		    				$timeout(function(){
		    					$scope.$emit("showCollect",false);
		    					transData.pwd1 = "",transData.pwd2 = "",transData.password = "",transData.mobileCheckNo = "",transData.mobileNo = "";
	    						$scope.$emit("goNext","/mine");
		    				},transData.promptTime);
		    			}else{
		    				$scope.$emit("loadingChange",false);
		    				$scope.$emit("promptAlertMsg","连接超时");
		    				$scope.$emit("showCollect",true);
		    				$timeout(function(){
		    					$scope.$emit("showCollect",false);
		    					transData.pwd1 = "",transData.pwd2 = "",transData.password = "",transData.mobileCheckNo = "",transData.mobileNo = "";
	    						$scope.$emit("goNext","/mine");
		    				},transData.promptTime);
		    			}
		    		});
    	}
    	
    	//当键盘被销毁的时候
        $scope.$on("$destroy", function() {
        	$timeout.cancel(timeOutFn);
	    });
    	
    	
        $scope.$apply();
    }];
});